<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateSlideOpRecordTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('slide_op_record', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('user_id')->default(0)->comment('用户ID');
            $table->integer('moment_user_id')->default(0)->comment('操作对象ID');
            $table->integer('moment_id')->default(0)->comment('操作动态ID');
            $table->tinyInteger('op')->default(0)->comment('0-左滑,1-右滑');
            $table->timestamps();
            $table->tinyInteger('flag')->default(1)->comment('状态');
            $table->index(['user_id', 'moment_user_id', 'moment_id'], 'user_op');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('slide_op_record');
    }
}
